import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
} from '@nestjs/common';
import { DictService } from './dict.service';
import { CreateDictDto } from './dto/create-dict.dto';
import { UpdateDictDto } from './dto/update-dict.dto';
import { Dict } from './entities/dict.entity';

@Controller('dict')
export class DictController {
  constructor(private readonly dictService: DictService) {}

  @Post('add')
  create(@Body() createDictDto) {
    return this.dictService.create(createDictDto);
  }

  @Get('all')
  findAll(@Query() findDictDto: Partial<Dict>) {
    return this.dictService.findAll(findDictDto);
  }
  @Get('dictionary/:dict')
  findDict(@Param('dict') dict: string) {
    return this.dictService.findDict(dict);
  }
  @Patch('update')
  update(@Body() updateDictDto: UpdateDictDto) {
    return this.dictService.update(updateDictDto);
  }

  @Delete('del/:ids')
  remove(@Param('ids') ids: string) {
    return this.dictService.remove(ids);
  }
}
